<template>
	<view class="content">
		<view class="topheader">
			<view class="topstatus">
				<image class="orderImg" :src="orderdatas.refundStatus | filterOrder" mode=""></image>
			</view>
			
		</view>
		<view class="group">
			<view class="group_section">
				<view class="goods" v-for="(item,index) in orderdatas.cartInfo" :key="index">
					<image class="goodsImg" :src="item.productInfo.image" mode="aspectFill"></image>
					<view class="goods_info">
						<view class="goods_name ellipsis_2">{{item.productInfo.storeName}}</view>
						<view class="goods_attr">{{item.attrInfo.sku}}</view>
						<view class="goods_price">
							<view class="price">
								<view class="pricesign iconfont">&#xe604;</view>
								<view class="money">{{item.attrInfo.price}}
									<text>+{{item.attrInfo.integral}}通宝</text>
								</view>
							</view>
							<view class="goods_num">x{{item.cartNum}}</view>
						</view>
					</view>
				</view>
			</view>
			<view class="section" >
				<view class="order_title">订单信息</view>
				<view class="order_info_list">
					<view class="order_list_left">退款编号</view>
					<view class="order_info_detail">{{orderdatas.orderId}}</view>
				</view>
				<view class="order_info_list">
					<view class="order_list_left">申请原因</view>
					<view class="order_info_detail">{{orderdatas.refundReasonWap}}</view>
				</view>
				<view class="order_info_list">
					<view class="order_list_left">申请金额</view>
					<view class="order_info_detail"><text class="iconfont sign">&#xe604;</text>{{orderdatas.totalPrice}}
						<text>+{{orderdatas.totalIntegral}}通宝</text>
					</view>
				</view>
				<view class="order_info_list">
					<view class="order_list_left">申请时间</view>
					<view class="order_info_detail">{{orderdatas.refundReasonTime}}</view>
				</view>
				
			</view>
			
		</view>
	
	
	</view>
</template>

<script>
	export default {
		data() {
			return {
				key:'' ,// 订单唯一标识
				orderdatas:{},
				
			}
		},
		onLoad(options) {
			console.log(options)
			if (Object.keys(options).length != 0) {
				this.key = options.key;
				this.getOrderDetail()
			}
			let that = this;
			uni.$on('myOrderDetail',function(data){
			    console.log('监听到事件来自 update ，携带参数 msg 为：' + data.msg);
				that.getOrderDetail(); //调用加载
			})
		},
		
		filters:{
			filterOrder: function (val) {
				if (val == 2) {
					return '//order6.png'
				} 
			}
			
		},
		methods: {
			
			// 获取订单详情
			getOrderDetail: function () {
				let that = this;
				that.api.shoppingOrderDetail(that.key).then(res => {
					console.log(res)
					that.orderdatas = res.data;
				})
			},
			
		}
	}
</script>

<style lang="less">
	page {
		width: 100%;
		box-sizing: border-box;
		letter-spacing: 3rpx;
		background: #F5F5F5;
		font-family: 'PingFang SC';
		font-size: 28rpx;
		color: #212121;
	}
	.content {
		width: 100%;
		box-sizing: border-box;
	}
	.topheader {
		width: 100%;
		box-sizing: border-box;
		.topstatus {
			width: 100%;
			box-sizing: border-box;
			height: 380rpx;
			.orderImg {
				width: 100%;
				height: 100%;
			}
		}
	}
	.group {
		width: 100%;
		box-sizing: border-box;
		padding: 10rpx 20rpx;
		margin-bottom: 130rpx;
		.group_section {
			width: 100%;
			box-sizing: border-box;
			padding: 10rpx 20rpx;
			background: #FFFFFF;
			position: relative;
			left: 0;
			top: -100rpx;
			z-index: 2;
			border-radius: 12rpx;
			.goods {
				width: 100%;
				box-sizing: border-box;
				display: flex;
				justify-content: space-between;
				padding: 20rpx 0;
				.goodsImg {
					width: 160rpx;
					height: 160rpx;
					border-radius: 16rpx;
				}
				.goods_info {
					width: calc(100% - 160rpx);
					box-sizing: border-box;
					padding-left: 20rpx;
					display: flex;
					flex-flow: column;
					justify-content: space-between;
					font-size: 28rpx;
					color: #140005;
					.goods_price {
						width: 100%;
						box-sizing: border-box;
						display: flex;
						justify-content: space-between;
						align-items: center;
						font-size: 22rpx;
						color: #212121;
						.price {
							display: flex;
							justify-content: flex-start;
							align-items: center;
							font-size: 28rpx;
							color: #E42221;
							.pricesign {
								color: #FFDA71;
								font-size: 26rpx;
								// padding-top: 5rpx;
							}
						}
					}
					.goods_attr {
						width: 100%;
						box-sizing: border-box;
						font-size: 24rpx;
						color: #999999;
					}
					
				}
				
				
			}
		}
		
		.section {
			width: 100%;
			box-sizing: border-box;
			background: #FFFFFF;
			border-radius: 12rpx;
			position: relative;
			left: 0;
			top: -80rpx;
			z-index: 3;
			.order_total {
				width: 100%;
				box-sizing: border-box;
				line-height: 100rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 0 22rpx;
				border-bottom: 2rpx solid #F5F5F5;
				font-size: 28rpx;
				color: #333333;
			}
		
			.order_title {
				width: 100%;
				box-sizing: border-box;
				padding: 0 20rpx;
				line-height: 102rpx;
				font-size: 30rpx;
				font-weight: 500;
			}
			.order_info_list {
				width: 100%;
				box-sizing: border-box;
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 20rpx;
				line-height: 60rpx;
				font-size: 28rpx;
				color: #212121;
				border-top: 2rpx solid #F5F5F5;
				.order_list_left {
					width: 162rpx;
					box-sizing: border-box;
					color: #666666;
				}
				.sign {
					color: #FFDA71;
					font-size: 30rpx;
				}
				
			}
			
		}
		
	}
	
	
</style>
